package aer.numerosVampiro;

import java.util.Scanner;
import java.util.Vector;

public class NumerosVampiro {
	private static Scanner scan = new Scanner(System.in);

	private static void generateR(String source, String partial, Vector out) {
		String newPartial = new String(partial);
		String newSource;
		if (source.length() == 0) {
			out.addElement(newPartial);
			return;
		}
		
		System.out.println("source: "+source);
		
		for (int i = 0; i < source.length(); i++) {
			newPartial = partial.concat(source.substring(i, i + 1));
			newSource = source.substring(0, i);
			if (i < (source.length() + 1))
				newSource = newSource.concat(source.substring(i + 1,
						source.length()));
			generateR(newSource, newPartial, out);
		}
	}

	public static Vector generate(String source) {
		Vector out = new Vector();
		String partial = new String();
		generateR(source, partial, out);

		return out;
	}

	public static void main(String[] args) {
		int casos = scan.nextInt();

		for (int d = 0; d < casos; d++) {
			programa();
		}

	}

	private static void programa() {
		String n = scan.next();
		int l = n.length();

		if (l % 2 == 0) {
			calcular(n);
		} else {
			System.out.println("NO");
		}

	}

	private static void calcular(String n) {
		boolean b = false;

		int l = n.length();
		int l2 = l / 2;
		Vector v = generate(n);
		for (int i = 0; i < v.size(); i++) {
			String num = (String) v.elementAt(i);

			String n1 = "";
			String n2 = "";

			for (int m = 0; m < l2; m++) {
				n1 += num.charAt(m);
			}
			for (int m = l2; m < l; m++) {
				n2 += num.charAt(m);
			}
			long n1n = Long.parseLong(n1);
			long n2n = Long.parseLong(n2);

			long sol = n1n * n2n;
			if ((sol + "").equals(n)) {
				b = true;
				break;
			}

		}

		if (b) {
			System.out.println("SI");
		} else {
			System.out.println("NO");
		}

	}
}